from selenium.webdriver.common.by import By
from LoginCart.base.basePage import BasePage, BaseHandle

class PageDetail(BasePage):
    def __init__(self):
        super().__init__()
        self.img=By.XPATH, "//div[@class='xs_img']/a[1]"
        self.cart= By.CSS_SELECTOR, "#join_cart"
    def find_img(self):
        return self.get_element(self.img)

    def find_cart(self):
        return self.get_element(self.cart)

class HandleDetail(BaseHandle):
    def __init__(self):
        self.page_detail=PageDetail()

    def click_img(self):
        self.page_detail.find_img().click()

    def click_cart(self):
        self.page_detail.find_cart().click()

class ProxyDetail:
    def __init__(self):
        self.handle_detail=HandleDetail()
    def go_cart(self):
        self.handle_detail.click_img()
        self.handle_detail.click_cart()